package Leetcode;

class solution_100 {
    public boolean isSameTree(TreeNode p, TreeNode q) {
        return isSame(p, q);
    }

    public boolean isSame(TreeNode p, TreeNode q) {
        int value1 = p == null ? Integer.MIN_VALUE : p.val;
        int value2 = q == null ? Integer.MIN_VALUE : q.val;
        if (value1 != value2)
            return false;
        if (value1 == Integer.MIN_VALUE && value1 == Integer.MIN_VALUE)
            return true;
        return isSame(p.left, q.left) && isSame(p.right, q.right);
    }
}

public class Solution100 {

}
